package com.wangp.mywrite.coding;

import java.util.Arrays;

/**
 * @description: 玩筹码
 * @author tooStronger
 * @date 2022/7/8
 */
public class MinCostToMoveChips {

    public int minCostToMoveChips(int[] position) {

        Arrays.sort(position);
        int cost = 0;
        int first = position[0];
        for (int i = 1; i < position.length; i++) {
            int tmp = position[i];
            if(tmp % 2 == first % 2){
                continue;
            }
            cost++;
        }
        return cost;
    }
}
